package yaut;
import javax.swing.ImageIcon;

import java.awt.Toolkit;


/**
 * Gere toutes les images de l'application
 * Chaque image est charger et devient accessible comme des variables globale
 * 
 * @author Delmas Gabriel
 */
public class Ressource 
{
	//Images de la palette
	static public ImageIcon image_selectionSouris;
	static public ImageIcon image_composantClasse;
	static public ImageIcon image_composantAggregation;
	static public ImageIcon image_composantHeritage;
	static public ImageIcon image_composantNote;
	static public ImageIcon image_composantComposition;
	static public ImageIcon image_composantLienNote;
	
	//Images de l'arbre (JTree)
	static public ImageIcon image_minusJTree;
	static public ImageIcon image_plusJTree;
	static public ImageIcon image_ClasseJTree;
	static public ImageIcon image_AttributPrivateJTree;
	static public ImageIcon image_AttributProtectedJTree;
	static public ImageIcon image_AttributPublicJTree;
	static public ImageIcon image_MethodePrivateJTree;
	static public ImageIcon image_MethodeProtectedJTree;
	static public ImageIcon image_MethodePublicJTree;
	static public ImageIcon image_AgregationJTree;
	static public ImageIcon image_HeritageJTree;
	
	//Icones de l'application
	static public ImageIcon image_IconeDebug;
	static public ImageIcon image_IconeYaut;
	
	/**
	 * Permet de charger toutes les images
	 */
	static public void chargerRessource()
	{

		image_selectionSouris = new ImageIcon("Images/Selection.gif");
		image_composantClasse = new ImageIcon("Images/Classe.gif");
        image_composantAggregation = new ImageIcon("Images/Aggregation.gif");
        image_composantHeritage = new ImageIcon("Images/Heritage.gif");
        image_composantNote = new ImageIcon("Images/Note.gif");
        image_composantComposition = new ImageIcon("Images/Composition.gif");
        image_composantLienNote = new ImageIcon("Images/LienNote.gif");	
        
        image_minusJTree = new ImageIcon("Images/minus.png");
        image_plusJTree = new ImageIcon("Images/plus.png");
        image_ClasseJTree = new ImageIcon("Images/ClasseJTree.gif");
        image_AttributPublicJTree = new ImageIcon("Images/AttributPublicJTree.gif");
        image_AttributProtectedJTree = new ImageIcon("Images/AttributProtectedJTree.gif");
        image_AttributPrivateJTree = new ImageIcon("Images/AttributPrivateJTree.gif");
        image_MethodePrivateJTree = new ImageIcon("Images/MethodePrivateJTree.gif");
        image_MethodeProtectedJTree = new ImageIcon("Images/MethodeProtectedJTree.gif");
        image_MethodePublicJTree = new ImageIcon("Images/MethodePublicJTree.gif");
        image_AgregationJTree = new ImageIcon("Images/AgregationJTree.gif");
        image_HeritageJTree = new ImageIcon("Images/HeritageJTree.gif");
        
        image_IconeDebug = new ImageIcon("Images/icone_debug.gif");
        image_IconeYaut = new ImageIcon("Images/icone_yaut.gif");

	}
	
	/**
	 * Permet de charger une image directement a partir du .jar
	 * @param imageName le chemin de l'image a charger
	 * @return ImageIcon contenant l'image charge
	 */
	protected ImageIcon getImageFromJAR(String imageName)
	{
	    ImageIcon image = new ImageIcon();
	    try
	    {
	      image.setImage((Toolkit.getDefaultToolkit().getImage(getClass().getResource("Images/"+imageName))));
	    }
	    catch(Exception ex)
	    {
	      System.out.println("Image Error: " + ex);
	    }
	    return image;
	}
}
